package lab02.test11;

public class Rectangle implements Printx {
    double length;
    double width;

    Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }
    double getPerimeter(){
        return ( length+width)*2.0;
    }
    double getArea(){return  length*width;}
    @Override
    public void printMyWay() {
//printMyWay()方法要能显示矩形的边长、面积和周长
        System.out.println("矩形的长length="+length+"宽width="+width);
        System.out.println("面积area="+getArea());
        System.out.println("周长perimeter="+getPerimeter());
    }
}
